Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | import { apiService } from './api';
import type { ApiResult, UserProfile, ChangePasswordRequestPayload } from '@/types';
class UserProfileService {
async getProfile(): Promise<ApiResult<UserProfile>> {
return apiService.get<UserProfile>('/api/user/profile');
}
async updateProfile(payload: { email?: string | null }): Promise<ApiResult<UserProfile>> {
return apiService.put<UserProfile>('/api/user/profile', payload);
}
async changePassword(payload: ChangePasswordRequestPayload): Promise<ApiResult<{ success: boolean; message: string }>> {
return apiService.put<{ success: boolean; message: string }>('/api/user/profile/password', payload);
}
}
export const userProfileService = new UserProfileService();
|